<template>
    <div class="box-wrap">
        <el-row :gutter="20">
            <el-col :span="4" v-for="(item,index) in dataList" :key="index">
                <div class="btn" :class="item.status | statusToColor" @click="goEnter(item)">{{ item.scodeName }}</div>
            </el-col>
        </el-row>
    </div>
</template>

<script>
import Api from './api/api';

export default {
    data() {
        return {
            dataList:[],
            defaultProps: {
                children: 'childList',
                label: 'scodeName'
            },
            dialogVisible:false,
            dateRange:[],
        }
    },
    created(){
        this.getPtTree()
    },
    destroyed () {

    },
    methods: {
        //获取数据
        getPtTree(){
            let callBack = res => {
                this.dataList = res.data
            }
            Api.getPtTree({},callBack)
        },
        goEnter(item){
            this.$router.push({ name: 'dataDetectionSecond', params: { scode: item.scode, ptIp: item.ptIp }})
        }
    },
    filters:{
        statusToColor(obj){
            let item={
                0:'red',
                1:'green'
            }
            return item[obj]
        }
    }
}
</script>
<style scoped>



.el-col{
    margin-bottom: 20px;
}

.box-wrap{
    width: 100%;
    height: calc(100% - 50px);
    padding: 30px;
    border: 1px solid #0b7b86;
        box-shadow: inset 0 0 12px 2px #0b7b86;
    box-sizing: border-box;
    min-width: 1300px;
}
.box-wrap .btn{
    width: 180px;
    height: 40px;
    text-align: center;
    line-height: 40px;
    border: 1px solid #0b7b86;
    border-radius: 20px;
    cursor: pointer;
}

.box-wrap .btn.green{
    background: #0b7b86;
}

.box-wrap .btn.red {
    background: #F56C6C;
    border-color: #F56C6C;
}

.tit{
    word-wrap: break-word;
}
</style>

